<?php
	include ("classConnexion.php");
	$laBase = new clstBDD;
	$laBase->connecte("localhost","slam10","avcknb8a");
	
	if ($laBase->getConnexion() != null) {
		//on interroge la base
		$curseur = $laBase->requeteSelect("select * from medicament where med_depotlegal='".$_POST["medicNum"]."'");
		$res = mysql_fetch_array($curseur);
		$reqFamille = $laBase->requeteSelect("select fam_libelle from famille where fam_code='".$res["FAM_CODE"]."'");
		$reqFamille = mysql_fetch_array($reqFamille);	
	}
	
?>
<h1>Liste des médicaments</h1>
<table id="prodListe">	
	<tbody>
	<form id="frmMedicament" method="post" action="recupMEDICAMENT.php">
		<?php
		if ($laBase->getConnexion() != null) {
			//s'il reste un enregistrement non lu
			if ($res != "") {
				$idx = 5;
				//on positionne les champs avec les valeurs de la table		
				echo '<tr><th>DEPOT LEGAL :</th><td><input type="text" size="25" name="MED_DEPOTLEGAL" class="zone" value="'.$res["MED_DEPOTLEGAL"].'" /></td></tr>';
				echo '<tr><th>NOM COMMERCIAL :</th><td><input type="text" size="25" name="MED_NOMCOMMERCIAL" class="zone" value="'.$res["MED_NOMCOMMERCIAL"].'" /></td></tr>';
				echo '<tr><th>FAMILLE :</th><td><input type="text" size="67" name="FAM_CODE" class="zone" value="'.$reqFamille["fam_libelle"].'" /></td></tr>';
				echo '<tr><th>COMPOSITION :</th><td><textarea rows="5" cols="50" name="MED_COMPOSITION" class="zone" >'.$res["MED_COMPOSITION"].'</textarea></td></tr>';
				echo '<tr><th>EFFETS :</th><td><textarea rows="5" cols="50" name="MED_EFFETS" class="zone" >'.$res["MED_EFFETS"].'</textarea></td></tr>';
				echo '<tr><th>CONTRE INDIC. :</th><td><textarea rows="5" cols="50" name="MED_CONTREINDIC" class="zone" >'.$res["MED_CONTREINDIC"].'</textarea></td></tr>';
				echo '<tr><th>PRIX ECHANTILLON :</th><td><input type="text" size="7" name="MED_PRIXECHANTILLON" class="zone" value="'.$res["MED_PRIXECHANTILLON"].'" /></td></tr>';
				echo '<tr><th></th><td><input type="button" value="<" onClick="precedent();" ></input><input type="button" value=">" onClick="suivant();"></input></td></tr>';
				
			}
			$laBase->close();
		}
		?>
		</form>
</tbody>
</table>